  var id=getvl("id");
   var code=getvl("code");
  $(function(){
  	   if(id!=""){
dingdandaifukaun(id);
  	   }
  });
function dingdandaifukaun(){	
	$("#shijian").val("");
     $.ajax({
			url: urlcore + "/api/order/selectOrderForGoodsList4?id="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success:function(data){
				if(data.success == true) {
						$.each(data.data, function(y,n) {
							  var	leirong="";
          	var shijian=n.gmtDatetime.replace("-","/");
	var shijian2=shijian.replace("-","/");
	  var fukauns=/*<span class="dingdan_quxiao" onclick="bianhaos('+n.orderNumber+')">取消订单</span>'*/
		'<a id="zhifus" onclick="gotozhifu('+n.id+')">去支付</a>';
	              $("#fukuans").append(fukauns); 
				var dizhis=n.address.province+n.address.city+n.address.county+n.address.address;
			var dizhi=' <ul class="clearfix" style="width: 100%;"> '+
'<li><span>收&nbsp;&nbsp;货&nbsp;&nbsp;人</span>'+n.address.userName+'</li>'+
'        <li class="a_xiugai_right">'+
'            <span>电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话</span>'+n.address.userPhone+''+
'        </li>'+
'        <li><span>收货地址</span>'+dizhis+'</li>'+
'    </ul>';	
$("#shangshuliang").html(n.goodsNumber);
$("#heji").html("&yen;"+n.orderMoney);
		var feiyongmingxi='<li>商品总金额<span>&yen;'+n.orderMoney+'</span></li>'+
'        <li>总运费<span>+&yen;'+n.freightMoney+'</span></li>';
 var dingdanxingxi='<li>订单编号<span>'+n.orderNumber+'</span></li>'+
'        <li>创建时间<span>'+n.gmtDatetime+'</span></li>';
   $("#shifujine").html("&yen;"+n.payMoney);    
	$("#feiyongmingxi").append(feiyongmingxi);//费用信息
    $("#dingdanxingxi").append(dingdanxingxi);//费用信息

		  if(n.remark!=null){
			  	 $("#liuyan").html(n.remark);
			  }
		  		    var peisong="";
			    if(n.giveType==1){
			    	peisong="包邮";
			    }else if(n.giveType==2){
			    	peisong="快递";
			    }else if(n.giveType==3){
			    	peisong="物流到付";
			    }
			   $("#peisong").html(peisong);
			   $("#dizhi").append(dizhi);//地址		
				$("#shijian").val(shijian2);	
				$("#shopnaem").html(n.shop.storeName);
			if(n.goodsList!=null){
				$.each(n.goodsList,function(m,q){
			 leirong+='<div class="clearfix tuwen">'+
'    	<a href="javascript:void(0);">'+
'	        <div class="tuwen-img fl">'+
'	            <img onerror="errorImg2(this)" src="'+q.coverUrl+'" width="75" height="75">'+
'	        </div>'+
'	        <div class="tuwen-wenzi">'+
'	            <h5 class="wuye_h01">'+q.goodsTitle+'</h5>'+
'	            <div class="wuye_div01">产品质量均有保障</div>'+
'	        </div>'+
'        </a>'+
'    </div>';
			 $.each(q.myStockList,function(t,w){
			leirong += ' <div class="dingdan_fenlei clearfix">' +
 								'    	<ul class="fl">' +
 								'    		<li>颜色：<span>'+w.colour.colourName+'</span></li>'+
'    		<li>尺码：<span>'+w.size.sizeName+'</span></li>'+
'    		<li>单价：<span>'+w.goodsCar.packRate+'元/件</span></li>'+
'</ul>' +
 								'    	<div class="fr">' +
 								'    		<h6>' +w.saleNum+'件</h6>' +
 								'    	</div>' +
 								'    </div>';
			 });
			});
				$("#neirong").append(leirong);
			}
				});
	$(function(){
		  $(".dingdan_quxiao").on('click',function(){
        $("body").append("<div id='mask'></div>");
        $(".show-quxiao").show();
    })
    //点击关闭
    $(".Quxiao").on('click',function(){
        $(".show-quxiao").hide();
        $("#mask").remove();
    }) 
	})
				}else{
				var dingdan ='<img src="../images/guoqis.jpg" style="width: 100%;height: 100%;"/>';
					   $("#dingdansss").html(dingdan);
				}
			},
			error:function() {
				alert("error");
			}
		});
		

}



function gotozhifu(ids){
	      sessionStorage.setItem("oderids",ids);
         if(ids!="" && ids!=null){
window.location.href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx242f8ebb59f20be1&redirect_uri=http://wx.jiagangwangluo.com/wx/12.1.1zhifuodergoods.html&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
          }  
          
}


function bianhaos(te){
	$("#biaohaos").val("");
	$("#biaohaos").val(te);
}

function  querenquxiao(){
	 var biaohaos=$("#biaohaos").val();  
	 if(biaohaos==''){
	 }else{
   	  $.ajax({
      url: urlcore+"/api/order/cancelOrder?orderNumber="+biaohaos,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
						window.location.href = document.referrer;
					//selectGoodsList2();
					//var dangqian=window.location.href;
					window.location.href=dangqian;
				//  alert("取消成功");
				  	 
				}
		/*console.log(goodslist);*/
			},
			error: function() {
				alert("error");
			}
		});
}
	 
	 
}
